home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickDraw3D 1.6 SDK / Mac SampleCode New for 1.6 / RollerCoasterSampleMac / Interfaces / Track.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-18  |  4.4 KB  |  157 lines  |  [TEXT/dosa]

  1. /*
  2.     File:        Track.h
  3.     
  4.     Contains:    Interface file for Track.c
  5.     
  6.     Written by:    Scott Kuechle, based on original Gerbils code by Brian Greenstone
  7.  
  8.     Copyright:    © 1998 by Apple Computer, Inc. All rights reserved
  9.     
  10.     Change History (most recent first)
  11.     
  12.         <1>        9/1/98        srk        first file
  13.  
  14.  
  15. */
  16.  
  17. #pragma once
  18.  
  19. /************************************************************
  20. *                                                           *
  21. *    INCLUDE FILES                                          *
  22. *                                                           *
  23. *************************************************************/
  24.  
  25. #if defined(_MSC_VER)
  26. #include "WinPrefix.h"
  27. #else
  28. #include <ConditionalMacros.h>
  29. #endif
  30.  
  31. #if TARGET_OS_WIN32
  32.     #include <QTML.h>
  33.     #define    STRICT
  34.     #include <windows.h>
  35. #endif
  36.  
  37.  
  38. #include <Resources.h>
  39. #include <Math.h>
  40.  
  41. #include "QD3DMath.h"
  42. #include "QD3DCamera.h"
  43. #include "QD3DGeometry.h"
  44. #include "QD3DGroup.h"
  45. #include "QD3DView.h"
  46.  
  47. #include "Utils.h"
  48.  
  49. /************************************************************
  50. *                                                           *
  51. *    CONSTANTS                                              *
  52. *                                                           *
  53. *************************************************************/
  54.  
  55. #define kSkipAheadPoints    2
  56. #define    kMaxFacesInMesh        20
  57. #define    kTrackWidth            0.4F
  58. #define    kMaxSplinePoints    5000
  59.  
  60. #define    DISTANCE_FROM_TRACK_TO_CAMERA        0.5F
  61. #define    LAZY_SUSAN_RADIUS                    /*50.0F*/38.0F
  62.  
  63. #define    kPartType            'Part'
  64.  
  65. #define    MAX_PARTS                100
  66. #define    MAX_SPLINE_NUBS            300L
  67. #define    MAX_SPLINE_POINTS        40000L
  68. #define    MAX_TRACK_SECTIONS        18
  69.  
  70. #if TARGET_OS_WIN32
  71.  
  72.     #define kPartDataFileName "TrackPartData.dat"
  73.  
  74. #endif
  75.  
  76. /************************************************************
  77. *                                                           *
  78. *    STRUCTURE DEFINITIONS                                  *
  79. *                                                           *
  80. *************************************************************/
  81.  
  82.         /* TRACK SECTION TYPE */
  83. #if PRAGMA_STRUCT_ALIGN
  84.     #pragma options align=mac68k
  85. #elif PRAGMA_STRUCT_PACKPUSH
  86.     #pragma pack(push, 1)
  87. #elif PRAGMA_STRUCT_PACK
  88.     #pragma pack(1)
  89. #endif
  90.  
  91.     struct TrackSectionType
  92.     {
  93.         long        partNum;
  94.         TQ3Point3D    nubCoord;
  95.     };
  96.     typedef struct TrackSectionType TrackSectionType;
  97.     
  98.     struct NubEntryType
  99.     {
  100.         TQ3Point3D        basePt;        /* base spline coord */
  101.         TQ3Point3D        upPt;        /* point above base */
  102.         long            sectionNum;        /* section # that this nub belongs to */
  103.     };
  104.     typedef struct NubEntryType NubEntryType;
  105.     
  106.     struct PartType
  107.     {
  108.         Byte            numNubs;
  109.         NubEntryType    *coordsPtr;
  110.     };
  111.     typedef struct PartType PartType;
  112.  
  113. #if PRAGMA_STRUCT_ALIGN
  114.     #pragma options align=reset
  115. #elif PRAGMA_STRUCT_PACKPUSH
  116.     #pragma pack(pop)
  117. #elif PRAGMA_STRUCT_PACK
  118.     #pragma pack()
  119. #endif
  120.  
  121.  
  122. /************************************************************
  123. *                                                           *
  124. *    FUNCTION PROTOTYPES                                    *
  125. *                                                           *
  126. *************************************************************/
  127.  
  128. void Track_MakeRandomTrack(TrackSectionType    *trackSectionList,
  129.                             long numTrackSections);
  130. void Track_CreateMasterNubList(TrackSectionType *trackSectionList,
  131.                                 unsigned long        numTrackSections,
  132.                                 PartType             *partsList,
  133.                                 NubEntryType        *nubList,
  134.                                 long                *nubTotal);
  135. #if TARGET_OS_MAC
  136.     void Track_LoadPartsFromRez(PartType *partsList, short *partCount);
  137. #else if TARGET_OS_WIN32
  138.     void Track_LoadPartsFromFile(PartType *partsList, short *partCount);
  139. #endif
  140.  
  141. void Track_BuildCoasterGeometry_Mesh(long             skipValue,
  142.                                     TQ3GroupObject     theGroup,
  143.                                     long             numSplinePoints,
  144.                                     NubEntryType     *splinePointsPtr);
  145. void Track_CalcSplineCurve(NubEntryType     **splinePoints,
  146.                             long            maxSplinePoints,
  147.                             NubEntryType    *nubPoints,
  148.                             long            numSplineNubs,
  149.                             long            *numSplinePoints,
  150.                             float             subDivFactor);
  151. void Track_MoveCamera(TQ3CameraObject     camera,
  152.                     NubEntryType         *splinePtArray,
  153.                     long                 numSplinePoints,
  154.                     long                 *curTrackLocation);
  155. void Track_GetForwardVector(long trackIndex, NubEntryType *splinePointsPtr, long numSplinePoints, TQ3Vector3D *theVector);
  156. void Track_GetNormalVector(NubEntryType *splinePointsPtr, long trackIndex, TQ3Vector3D *theVector);
  157.